package com.wnhz.work.yz.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.wnhz.work.yz.R;

/**
 * Created by admin on 2016/12/23.
 */
public class SubjectAdapter extends BaseAdapter {
    private Context context;

    public SubjectAdapter(Context context) {
        this.context = context;
    }

    @Override
    public int getCount() {
        return 3;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        SubjectViewHolder viewHolder = new SubjectViewHolder();
        if (convertView == null) {
            convertView = LayoutInflater.from(context).inflate(R.layout.subject_content_item, null);
            viewHolder.iv_img = (ImageView) convertView.findViewById(R.id.iv_img);
            viewHolder.tv_name = (TextView) convertView.findViewById(R.id.tv_name);
            viewHolder.tv_type = (TextView) convertView.findViewById(R.id.tv_type);
            viewHolder.tv_price = (TextView) convertView.findViewById(R.id.tv_price);
            viewHolder.tv_number = (TextView) convertView.findViewById(R.id.tv_number);

            convertView.setTag(viewHolder);
        } else {
            viewHolder = (SubjectViewHolder) convertView.getTag();
        }


        return convertView;
    }

    class SubjectViewHolder {
        ImageView iv_img;
        TextView tv_name;
        TextView tv_type;
        TextView tv_price;
        TextView tv_number;
    }
}
